<?php
$page = 'Admin';
$in_site = 'dassnfu';
$loginVereist = true;
include($_SERVER['DOCUMENT_ROOT']."/start.php");

//Ben je wel ingelogd?
if(empty($_SESSION['spelerId'])) {
	include_once($_SERVER['DOCUMENT_ROOT']."/header.php");
	include_once($_SERVER['DOCUMENT_ROOT']."/sidebar.php");
	echo "<div id='main'><div id='submain'><div class='content'><div class='subcontent'>
		<div class='content_header'><h1>Admin dingetjes</h1></div>
		<div class='content_main'>";
	echo "<div class='error'><p class='icon'>Login om deze pagina te bekijken.</p></div>";
	echo "</div></div></div></div></div>";	//content_main, sub_content, content, sub_main, main
	include_once($_SERVER['DOCUMENT_ROOT']."/footer.php");
	die();
}
//Heb je wel het recht om deze pagina te bekijken?
if($mainClass->spelerId <> 2) {
	include_once($_SERVER['DOCUMENT_ROOT']."/header.php");
	include_once($_SERVER['DOCUMENT_ROOT']."/sidebar.php");
	echo "<div id='main'><div id='submain'><div class='content'><div class='subcontent'>
		<div class='content_header'><h1>Admin dingetjes</h1></div>
		<div class='content_main'>";
	echo "<div class='error'><p class='icon'>Je hebt niet het recht om deze pagina te bekijken.</p></div>";
	echo "</div></div></div></div></div>";	//content_main, sub_content, content, sub_main, main
	include_once($_SERVER['DOCUMENT_ROOT']."/footer.php");
	die();
}
if(empty($_GET['id'])) {
	include_once($_SERVER['DOCUMENT_ROOT']."/header.php");
	include_once($_SERVER['DOCUMENT_ROOT']."/sidebar.php");
	echo "<div id='main'><div id='submain'><div class='content'><div class='subcontent'>
		<div class='content_header'><h1>Admin dingetjes</h1></div>
		<div class='content_main'>";
	echo "<div class='error'><p class='icon'>Er is geen speler geselecteerd.</p></div>";
	echo "</div></div></div></div></div>";	//content_main, sub_content, content, sub_main, main
	include_once($_SERVER['DOCUMENT_ROOT']."/footer.php");
	die();
}

include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/my_query.php");
//$result = mysql_query("SELECT spelerId, gebruikersnaam, wachtwoord FROM Speler WHERE spelerId = '".$_GET['id']."'");
$myQuery->query = "SELECT spelerId, gebruikersnaam, wachtwoord FROM Speler WHERE spelerId = :spelerId";
$myQuery->parameters = array(
	'1' => array('name' => 'spelerId',		'value' => $_GET['id'],		'type' => PDO::PARAM_INT));
$myQuery->doQuery();

if($myQuery->isValidresult()) {
	$row = $myQuery->fetchRow();
	header("Location: http://localhost.nl/session_functions/inloggen.php?id=".$row['spelerId']."&ww=".$row['wachtwoord']);
	//echo "Location: http://mijnhonkbal.nl/session_functions/inloggen.php?id=".$row->spelerId;
}
?>